FROM myharbor.com/bigdata/centos:7.9.2009

RUN rm -f /etc/localtime && ln -sv /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo "Asia/Shanghai" > /etc/timezone

RUN export LANG=zh_CN.UTF-8

# 创建用户和用户组，跟yaml编排里的spec.template.spec.containers. securityContext.runAsUser: 1000
RUN groupadd --system --gid=1000 admin && useradd --system --home-dir /home/admin --uid=1000 --gid=admin admin

# 安装sudo
RUN yum -y install sudo ; chmod 640 /etc/sudoers

# 给admin添加sudo权限
RUN echo "admin ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers

RUN yum -y install install net-tools telnet wget tree

RUN mkdir -p /opt/apache/

### JDK
# wget https://cdn.azul.com/zulu/bin/zulu17.36.17-ca-jdk17.0.4.1-linux_x64.tar.gz
ADD zulu17.36.17-ca-jdk17.0.4.1-linux_x64.tar.gz /opt/apache/
ENV JAVA_HOME=/opt/apache/zulu17.36.17-ca-jdk17.0.4.1-linux_x64
ENV PATH=$JAVA_HOME/bin:$PATH

### trino
ENV TRINO_VERSION 398
ADD trino-server-${TRINO_VERSION}.tar.gz /opt/apache/
ENV TRINO_HOME=/opt/apache/trino
RUN ln -s /opt/apache/trino-server-${TRINO_VERSION} ${TRINO_HOME}
ENV PATH=${TRINO_HOME}/bin:$PATH

RUN mkdir ${TRINO_HOME}/data

RUN chown -R admin:admin /opt/apache

#RUN tree /opt/apache -L 3
#RUN ls -l /opt/apache/trino/bin/launcher

WORKDIR $TRINO_HOME
ENTRYPOINT $TRINO_HOME/bin/launcher run --verbose
